package com.niit.mapper;

import javax.annotation.Resource;


import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Repository;
/*
 * 可以直接在service层调用template链式方法模拟redis-client的各种操作 先注释掉此类
 * */
//@Repository
public class RedisDao {
	
	@Resource
	private StringRedisTemplate template;
	
	public void set(String key, String value){
		ValueOperations<String, String> ops = template.opsForValue();
		ops.set(key, value);
	}
	public String get(String key){
		ValueOperations<String, String> ops = template.opsForValue();
		return ops.get(key);
	}
	public String Lpush(String listName,String element){
		template.opsForList().leftPush(listName, element);
		return null;
	}
	
	
	

}
